import React, { Component } from 'react';
import NewIcon from '../icon/index'
import { Text, View } from '@tarojs/components'
import './index.scss'

type Props = {
  iconSize?: any
  isCheck?: boolean
  onChange: Function
  value?: string
  active: boolean
  size: any
}
type State = {
  check: boolean
}
export default class Radio extends Component<Props> {
  state: {
    check: false
  }

  constructor(props: Props) {
    super(props);
  }

  Change(data: any) {
    this.props.onChange();
  }

  render() {
    const { value, active, iconSize} = this.props;
    const size = this.props.size || '16px';
    return (
      <View onClick={this.Change.bind(this)} style='display: flex;align-items:center;'>
        <NewIcon
          className={`icon iconfont ${active? 'icon-shiquan-01': 'icon-quan-01'}`}
          font={iconSize || 16}
          color='#0bbe7f'
          top='4'
          style='position: relative; top: 1px; margin-right: 8px;'
        />
        <Text className='icon-text' style={`font-size: ${size};`}>{value}</Text>
      </View>
    )
  }
}
